<div id="vj_left">
    <?php
    foreach (Yii::app()->user->getFlashes() as $key => $message) {
        echo '<div style="color:blue;font-weight:bold;display:none" class="flash-' . $key . '">' . $message . "</div>\n";
    }
    ?>
    <script type="text/javascript">
        var $html = $(".flash-success").html();
        if ($.trim($html) != '' && $html != undefined) {
            alert($html);
        }
    </script>
    <div id="content" class="up-wrapper">

        <?php $form = $this->beginWidget('CActiveForm', array(
            'id' => 'product-form',
            'enableAjaxValidation' => false,
            'htmlOptions' => array(
                'role' => 'form',
                'class' => 'form-horizontal',
                'enctype' => 'multipart/form-data'
            )
        )); ?>


        <?php if ($model->getErrors()) {
            ?>
            <div class="alert alert-error">
                <?php echo $form->errorSummary($model); ?>
            </div>
        <?php } ?>

        <table>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'product_name', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textField($model, 'product_name', array('size' => 60, 'maxlength' => 255, 'class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'description', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textArea($model, 'description', array('id' => 'txtDescription', 'rows' => 6, 'cols' => 50, 'class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'cat_id', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->dropDownList($model, 'cat_id', CHtml::listData($categories, 'cat_id', 'cat_name'), array('class' => 'textbox')) ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'image_id', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->fileField($model, 'image'); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'price', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textField($model, 'price', array('class' => 'textbox')); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'currency', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->dropDownList($model, 'currency', array("VNĐ" => "VNĐ", 'USD' => 'USD'), array('class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'location', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->dropDownList($model, 'location', $locations, array('class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'buy_method_id', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->dropDownList($model, 'buy_method_id', CHtml::listData($methods, 'buy_method_id', 'buy_method_name'), array('class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'detail', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textArea($model, 'detail', array('class' => 'textbox', 'id' => 'txtDetail', 'rows' => 6, 'cols' => 50)); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'nick_ym', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textField($model, 'nick_ym', array('size' => 60, 'maxlength' => 255, 'class' => 'textbox')); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'nick_skype', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textField($model, 'nick_skype', array('size' => 60, 'maxlength' => 255, 'class' => 'textbox')); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model, 'website', array('class' => 'control-label')); ?>
                </td>
                <td>
                    <?php echo $form->textField($model, 'website', array('size' => 60, 'maxlength' => 255, 'class' => 'textbox')); ?>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <?php echo CHtml::submitButton('Gửi', array('class' => 'btn btn-default')); ?>
                </td>
            </tr>

        </table>
        <?php $this->endWidget(); ?>
    </div>
</div>
<div id="vj_right">
    <?php if (!Yii::app()->user->isGuest) {
        $this->widget('WidgetUserInfo', array('user_id' => $user_id));
    }?>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        KindEditor.ready(function (K) {
            window.editor = K.create('#txtDetail', {
                langType: 'en',
                resizeMode: 1,
                height: 500,
                width: 500,
                items: [
                    'bold', 'italic', 'underline',
                    'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist'
                ]
            });

            window.editor = K.create('#txtDescription', {
                langType: 'en',
                resizeMode: 1,
                height: 200,
                width: 500,
                items: [
                    'bold', 'italic', 'underline',
                    'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist'
                ]
            });
        });
    });
</script>